home *** CD-ROM | disk | FTP | other *** search
- class smashing.Base
- {
- var aT;
- var last;
- var currentWorld;
- static var interval;
- var bPlay = false;
- function Base()
- {
- if(smashing.Base.interval != null)
- {
- clearInterval(smashing.Base.interval);
- smashing.Base.interval = null;
- }
- this.aT = [];
- }
- function get playing()
- {
- return this.bPlay;
- }
- function play()
- {
- if(smashing.Base.interval == null)
- {
- this.bPlay = true;
- this.last = getTimer();
- smashing.Base.interval = setInterval(function(o)
- {
- o.update();
- }
- ,0,this);
- this.currentWorld.onPlay();
- }
- }
- function pause()
- {
- if(smashing.Base.interval != null)
- {
- this.bPlay = false;
- clearInterval(smashing.Base.interval);
- smashing.Base.interval = null;
- this.currentWorld.onPause();
- }
- }
- function update(o)
- {
- var _loc5_ = getTimer();
- var _loc6_ = (_loc5_ - this.last) / 1000;
- this.currentWorld.update(_loc6_);
- this.last = _loc5_;
- if(this.aT.length > 4)
- {
- var _loc4_ = undefined;
- _loc4_ = 0;
- var _loc3_ = 0;
- while(_loc3_ < this.aT.length)
- {
- _loc4_ += this.aT[_loc3_];
- _loc3_ = _loc3_ + 1;
- }
- _root.nDebug0 = _loc4_ / this.aT.length;
- this.aT = [];
- }
- this.aT.push(_loc6_);
- }
- function setWorld(oWorld)
- {
- if(oWorld != null)
- {
- this.currentWorld.onExit();
- this.currentWorld = oWorld;
- this.currentWorld.onEnter();
- }
- }
- static function hey()
- {
- }
- }
-